package com.hlg.xboot.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>Description: 查询项的操作类型</p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <p>Company: 智悦信息</p>
 * <p>Site: www.zhiyuesoft.com</p>
 * @author TZW
 * @version 1.0
 * @date 2017/07/31
 */

public enum QueryType {

    EQUALS("等于",1), NOT_EQUALS("不等于", 2),
    GREAT("日期大于",3), GREAT_OR_EQUALS("日期大于等于",4), LESS("日期小于",5), LESS_OR_EQUALS("日期小于等于",6),
    GT("数字大于", 7), GE("数字大于等于", 8), LT("数字小于", 9), LE("数字小于等于", 10),
    LIKE("模糊",11), START_LIKE("前模糊",12), END_LIKE("后模糊",13)
    ;

    private String desc;
    private Integer value;

    QueryType(String desc, Integer value) {
        this.desc = desc;
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public static QueryType getItem(int value) {
        QueryType item = null;
        QueryType[] items = QueryType.values();
        for (QueryType _item: QueryType.values()) {
            if (_item.getValue() == value) {
                item = _item;
                break;
            }
        }
        return item;
    }

    public static List toList() {
        List list = new ArrayList();
        for (QueryType _item: QueryType.values()) {
            Map<String, String> map = new HashMap<String, String>();
            map.put("value",String.valueOf(_item.getValue()));
            map.put("desc", _item.getDesc());
            list.add(map);
        }
        return list;
    }
    
}
